import http from '@/axios/http.ts'
import {
    createMenuRequest,
    searchMenuRequest,
    updateMenuRequest
} from '@/models/menuModel.ts'

/**
 * 添加菜单
 * @param {*} p 
 * @returns 
 */
export const createMenu = (props: createMenuRequest) => {
    return http.post('/Sys_Menu/CreateMenu', props);
}

/**
 * 修改菜单
 * @param {*} p 
 * @returns 
 */
export const updateMenu = (props: updateMenuRequest) => {
    return http.post('/Sys_Menu/UpdateMenu', props);
}

/**
 * 获取菜单列表
 * @param {*} p 
 * @returns 
 */
export const getMenuList = (props: searchMenuRequest) => {
    return http.get('/Sys_Menu/GetMenuList', props);
}

/**
 * 根据id获取菜单
 * @param {*} p 
 * @returns 
 */
export const getMenuById = (props: String) => {
    return http.get('/Sys_Menu/GetMenuById', props);
}

/**
 * 获取树形菜单
 * @param {*} p 
 * @returns 
 */
export const getMenuTree = () => {
    return http.get('/Sys_Menu/GetMenuTree');
}